<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="/shared/_layout.xhtml">
        <ui:define name="title">
            Espace d'administration de BooXtore.com
        </ui:define>
        <ui:define name="css">
            <h:outputStylesheet library="css" name="form.css"/>
            <h:outputStylesheet library="css/order" name="index.css"/>
        </ui:define>
        <ui:define name="content">
            <f:event listener="#{accountLogin.isNotLogged()}" type="preRenderView" />
            <h1>Gestion des commandes.</h1>

            <h:dataTable class="orders" value="#{orderManager.orders}" var="entry"
                         columnClasses="orders-id, orders-name, orders-price" >
                <h:column>
                    <f:facet name="header"></f:facet>
                    #<h:outputText value="#{entry.IDorders}"/>
                </h:column> 
                <h:column>
                    <f:facet name="header">Nom Client</f:facet>
                    <h:outputText value="#{entry.idUsers.firstname}"/>
                    <h:outputText value=" "/>
                    <h:outputText value="#{entry.idUsers.lastname}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">Prix T.T.C.</f:facet>
                    <h:outputText value="#{entry.netAmount}€"/>
                </h:column>
                <h:column>
                    <f:facet name="header">Status</f:facet>
                    <h:form>
                        <h:selectOneMenu value="#{entry.status}">
                            <f:selectItem itemLabel="Valider" itemValue="1"/>
                            <f:selectItem itemLabel="Préparation" itemValue="2"/>
                            <f:selectItem itemLabel="Annuler" itemValue="3"/>
                            <f:selectItem itemLabel="Envoyer" itemValue="4"/>
                        </h:selectOneMenu>
                        <h:commandButton value="Modifier" action="#{orderManager.update(entry)}"/>
                    </h:form>
                </h:column>
            </h:dataTable>
            <p>
                <h:link outcome="/index" class="back" value="Retour"/>
            </p>
        </ui:define>
    </ui:composition>
</html>